package com.kecheng.dao;

import com.kecheng.hibernate.BaseDao;
import com.kecheng.pojo.Guige;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class GuigeDao extends BaseDao {
	public List<Guige> findBySkuclassifyid(int skuclassifyid) {
		List<Guige> pattrs= (List<Guige>) this.getHibernateTemplate().find("from Guige where skuclassifyid=?",skuclassifyid);
		return pattrs;
	}
	
	public void add(Guige guige) {
		this.getHibernateTemplate().save(guige);
		
	}

	public void delete(Guige guige) {
		// TODO Auto-generated method stub
		this.getHibernateTemplate().delete(guige);
		
	}

	public Guige findById(int id) {
		List<Guige> guiges= (List<Guige>) this.getHibernateTemplate().find("from Guige where id=?",id);
		if(guiges.size()>0){
			return guiges.get(0);
		}
		return null;
	}

	public Guige findbybianma(String guigebianma) {
		// TODO Auto-generated method stub
		List<Guige> guiges= (List<Guige>) this.getHibernateTemplate().find("from Guige where guigebianma=?",guigebianma);
		if(guiges.size()>0){
			return guiges.get(0);
		}
		return null;
	}

	
	
}
